<%@ page import="java.util.List" %>
<%@ page import="com.jiazhong.Model.Goods" %><%--
  Created by IntelliJ IDEA.
  User: 陈洋
  Date: 2022/10/24
  Time: 20:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <style>
        table{
            width: 500px;
            border: 1px red solid;
            border-collapse: collapse;
        }
        th,td{
            height: 25px;
            line-height: 25px;
            text-align: center;
            border: 1px red solid;
        }
        th{
            background-color:darkgrey;
            font-weight: bold;
        }
    </style>
</head>
<body>
<h2 align="center">商品列表</h2>
<table align="center">
    <thead>
    <tr>
        <th>商品编号</th>
        <th>商品名称</th>
        <th>商品价格</th>
        <th>上架时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <%--<%
       List<Goods> goodsList=(List<Goods>) request.getAttribute("goodsList");
        for (Goods goods:goodsList) {
    %>
            <tr>
                <td><%=goods.getGoods_id()%></td>
                <td><%=goods.getGoods_name()%></td>
                <td><%=goods.getGoods_price()%></td>
                <td><%=goods.getGoods_time()%></td>
                <td>
                    <a href="queryGoodsById.do?goods_id=<%=goods.getGoods_id()%>">修改</a>
                    <a href="delGoodsById.do?goods_id=<%=goods.getGoods_id()%>">删除</a>
                </td>
            </tr>
    <%
        }
    %>--%>
    <c:forEach var="goods" items="${requestScope.goodsList}" varStatus="status">
        <tr>
            <td>${goods.goods_id}</td>
            <td>${goods.goods_name}</td>
            <%--<td>${goods.goods_price}</td>--%>
            <td>
                <fmt:formatNumber value="${goods.goods_price}" pattern="￥###,###.##"/>
            </td>
<%--            <td>${goods.goods_time}</td>--%>
            <td>
                <fmt:formatDate value="${goods.goods_time}" pattern="yyyy年MM月dd日"/>
            </td>
            <td>
                <a href="goods.do?method=queryGoodsById&goods_id=${goods.goods_id}">修改</a>
                <a href="goods.do?method=delGoodsById&goods_id=${goods.goods_id}>">删除</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
</body>
</html>
